package hot_100;

import java.util.Deque;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.TreeSet;

public class 最小栈 {
    public static void main(String[] args) {

    }

    Deque<int[]> deque = new LinkedList<>();


    public 最小栈() {
        deque.addFirst(new int[]{0, Integer.MAX_VALUE});
    }

    public void push(int val) {
        deque.addFirst(new int[]{val, Math.min(val,deque.getFirst()[1])});
    }

    public void pop() {
        deque.removeFirst();
    }

    public int top() {
        return deque.getFirst()[0];
    }

    public int getMin() {
        return deque.getFirst()[1];
    }
}
